import Vue from 'vue'
// 导入并绑定Vuex
import Vuex from 'vuex'
Vue.use(Vuex)
// 定义数据存储仓库state
const state = {
    username: localStorage.getItem('username')
}
// 定义用于修改数据的方法
const mutations = {
    setUsername:(state,username) => {
        state.username = username
        localStorage.setItem('username',username)
    }
}
// 异步修改数据
const actions = {}
// 计算属性
const getters = {
    // username:(state) => localStorage.getItem('username')
}
export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations
})
